Okay so in the last lecture we built a board for our game. Right now a 3x3 grid with 3 bombs looks a little something like this:
[['-', 'B', '-'], ['-', 'B', 'B'], ['-', '-', '-']]
What we now want is a function that will take a board as input and print each row on a new line, since we can't really play a game of minesweeper when the board looks like it does in the above example.
What we need is a function that will take a board and display it in a user-friendly fashion. Like so:
['-', 'B', '-']
['-', 'B', 'B']
['-', '-', '-']
Just as before, I recomend writing some tests before you start.
In [20]:
def test():
"""
Write your tests here...
Example:
>>> 1 + 1
2
"""
import doctest
doctest.testmod()
print("TESTING COMPLETE... if you see nothing, (other than this message) that means all tests passed.")
In [21]:
def display_board(board):
# your code here
pass
# Runing the tests...
test()
# Note if you recieve an error message saying test_board not found
# try hitting the run button on the test_board cell and try again.